<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>

<Script runat="server">

  Public Sub Page_Load(sender As Object, e As EventArgs)
    Dim connection As SqlConnection
    Dim command As SqlCommand
    Dim reader As SqlDataReader
    Dim sqlSelect As String
    Dim dsn As String
    
    ' Name dsn and sql select
    dsn="server=localhost;uid=sa;pwd=aido;database=InterShop"
    sqlSelect="Select * From tblSubCategories"
    sqlSelect +=" where SubCateID>10"
    ' Connect to the database
    connection = New SqlConnection(dsn)
    command = New SqlCommand(sqlSelect, connection)

    ' Open the connection
    connection.Open()

    ' Create the reader
    reader = command.ExecuteReader()

    ' Populate the datagrid
    datagrid1.DataSource = reader
    datagrid1.DataBind()

    ' Close the connection
    connection.Close()
  End Sub

</Script>
<asp:datagrid id="datagrid1" runat="server" />
